package com.xxx.service;

import com.xxx.dao.StudentDao;
import com.xxx.dao.StudentDaoImpl;

import java.util.*;

/**
 * @version v1.0
 * @Description:
 * @Author zhanzhongxin
 * @Date 2021/8/16 10:08
 * @Copyright 博为峰
 */
public class StudentServiceImpl implements StudentService {

    public String name;
    public Date date;

    public List<String> list;
    public Set<String> set;
    public Map<String, String> map;
    public String[] array;

    public StudentDao studentDao;

    public StudentDao getStudentDao() {
        return studentDao;
    }

    public void setStudentDao(StudentDao studentDao) {
        this.studentDao = studentDao;
    }

    public List<String> getList() {
        return list;
    }

    public void setList(List<String> list) {
        this.list = list;
    }

    public Set<String> getSet() {
        return set;
    }

    public void setSet(Set<String> set) {
        this.set = set;
    }

    public Map<String, String> getMap() {
        return map;
    }

    public void setMap(Map<String, String> map) {
        this.map = map;
    }

    public String[] getArray() {
        return array;
    }

    public void setArray(String[] array) {
        this.array = array;
    }

    public StudentServiceImpl(String name, Date date) {
        System.out.println("StudentServiceImpl(String name, Date date)");
        this.name = name;
        this.date = date;
    }

//    public StudentServiceImpl() {
//        System.out.println("StudentServiceImpl对象创建");
//    }

    public void init() {
        System.out.println("init...");
    }

    @Override
    public int addStudent() {
//        final StudentDaoImpl studentDao = new StudentDaoImpl();
        System.out.println("studentService");
        return studentDao.insertStudent();
    }

    private void destroy() {
        System.out.println("destroy...");
    }

    @Override
    public String toString() {
        return "StudentServiceImpl{" +
                "name='" + name + '\'' +
                ", date=" + date +
                ", list=" + list +
                ", set=" + set +
                ", map=" + map +
                ", array=" + Arrays.toString(array) +
                '}';
    }
}
